<!-- 万能材料试验机 -->
<template>
  <div class="app-container">
    <el-row :gutter="20">
      <el-col :span="show ? rowObj.T1 : rowObj.F1" :xs="show ? rowObj.T2 : rowObj.F2">
        <workSiteLeft ref="workSiteLeft" :show="show" @showLeft="showLeft" @queryVal="queryVal" />
      </el-col>

      <el-col :span="show ? rowObj.T3 : rowObj.F3" :xs="show ? rowObj.T4 : rowObj.F4">
        <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" style="display: flex;justify-content: space-between;">
          <div>
            <!-- <el-form-item label="工地名称" prop="id">
              <el-select v-model="queryParams.id" clearable placeholder="请选择工地名称">
                <el-option v-for="item in constructionList" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>
            </el-form-item> -->

            <el-button style="margin: 3px 8px 0 0;" size="mini" :icon="show ? 'el-icon-s-fold' : 'el-icon-s-unfold'" circle @click="showLeft(show)"></el-button>
            <el-form-item label="万能机型号" prop="deviceModel">
              <el-input style="width: 150px" v-model.trim="queryParams.deviceModel" placeholder="请输入万能机型号" clearable></el-input>
            </el-form-item>

            <el-form-item label="实验时间">
              <deatetime ref="deatetime" v-model="queryParams.time"> </deatetime>
            </el-form-item>

            <el-form-item label="是否合格" prop="eligible">
              <el-select style="width: 100px" v-model="queryParams.eligible" clearable size="mini" placeholder="请选择">
                <el-option v-for="item in eligibleList" :key="item.id" :label="item.name" :value="item.id"></el-option>
              </el-select>
            </el-form-item>

            <el-form-item>
              <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery" v-hasPermi="['laboratoryManage:omnipotentMaterial:query']">搜索</el-button>
              <!-- <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button> -->
            </el-form-item>
          </div>

          <el-form-item>
            <el-button type="success" icon="el-icon-thumb" size="mini" v-hasPermi="['laboratoryManage:omnipotentMaterial:collectTest']" :loading="warningLoading" @click="handleCollectData">数据采集测试</el-button>
          </el-form-item>
        </el-form>

        <el-table border v-loading="loading" :data="cementDataList" size="mini">
          <el-table-column label="试验名称" align="center" prop="symc" min-width="95" show-overflow-tooltip/>
          <!-- <el-table-column label="所属单位" align="center" prop="deptName" width="110" show-overflow-tooltip/> -->
          <el-table-column label="设备名称" align="center" prop="deviceName" min-width="110" show-overflow-tooltip />
          <el-table-column label="设备型号" align="center" prop="deviceModel" min-width="90" show-overflow-tooltip />
          <el-table-column label="试验编号" align="center" prop="sybh" min-width="180" show-overflow-tooltip />
          <el-table-column label="试样数量" align="center" prop="sysl" min-width="73px" />
          <el-table-column label="公称直径(mm)" align="center" prop="gczj" min-width="105" />
          <el-table-column label="面积(mm²)" align="center" prop="area" min-width="83" />
          <el-table-column label="原始标距" align="center" prop="lo" min-width="73px" />
          <el-table-column label="试验时间" align="center" prop="sysj" width="135">
          </el-table-column>
          <!-- <el-table-column label="试验状态" align="center">
            <template slot-scope="scope">
              <span>{{ scope.row.tag == 0 ? "未完成" : "已完成" }}</span>
              状态标记 0:该组试验未完成 1:该组试验完成
            </template>
          </el-table-column> -->
          <el-table-column label="是否合格" align="center" width="73px">
            <template slot-scope="scope">
              <span>{{ scope.row.eligible == 1 ? "合格" : (scope.row.eligible == 0 ? "不合格": "未校验")}}</span>
            </template>
          </el-table-column>
          <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="260" fixed="right">
            <template slot-scope="scope">
              <el-button size="mini" type="text" @click="handleDetails(scope.row)" v-hasPermi="['laboratoryManage:omnipotentMaterial:details']">详情</el-button>
              <el-button size="mini" type="text" @click="check(scope.row)" v-hasPermi="['laboratoryManage:omnipotentMaterial:check']">数据校验</el-button>
              <el-button size="mini" type="text" icon="el-icon-edit" @click="result_handleUpdate(scope.row)" v-hasPermi="['laboratoryManage:omnipotentMaterial:editing']">报表编辑</el-button>
              <el-button size="mini" type="text" icon="el-icon-tickets" @click="handleReportForms(scope.row)" v-hasPermi="['laboratoryManage:omnipotentMaterial:preview']">报表预览</el-button>
            </template>
          </el-table-column>
        </el-table>

        <pagination v-show="total > 0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
      </el-col>
    </el-row>
    <!-- 详情 -->
    <el-dialog title="详情" :visible.sync="rowDetailsDialog" width="70%">
      <el-table border v-loading="loadingTwo" :data="detailsList" size="mini">
        <el-table-column label="序号" type="index" align="center" width="50" />
        <el-table-column label="直径(mm)" align="center" width="80">
          <template slot-scope="scope">
            <span>{{ scope.row.gczj || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="截面面积(mm²)" align="center" width="110">
          <template slot-scope="scope">
            <span>{{ scope.row.area || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="原始标据" align="center" width="75">
          <template slot-scope="scope">
            <span>{{ scope.row.lo || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="引申计标距(mm)" align="center" width="120">
          <template slot-scope="scope">
            <span>{{ scope.row.le || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="极限荷载(kN)" align="center" width="110">
          <template slot-scope="scope">
            <span>{{ scope.row.fm || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="极限强度(MPa)" align="center" width="110">
          <template slot-scope="scope">
            <span>{{ scope.row.rm || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="上屈服荷载(kN)" align="center" width="120">
          <template slot-scope="scope">
            <span>{{ scope.row.feH || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="上屈服强度(MPa)" align="center" width="125">
          <template slot-scope="scope">
            <span>{{ scope.row.reH || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="下屈服荷载(kN)" align="center" width="120">
          <template slot-scope="scope">
            <span>{{ scope.row.feL || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="下屈服强度(MPa)" align="center" width="125">
          <template slot-scope="scope">
            <span>{{ scope.row.reL || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="塑性延伸力(kN)" align="center" width="115">
          <template slot-scope="scope">
            <span>{{ scope.row.fp || "0" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="塑性延伸强度(MPa)" align="center" width="135">
          <template slot-scope="scope">
            <span>{{ scope.row.rp || "0" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="断后标距(mm)" align="center" width="105">
          <template slot-scope="scope">
            <span>{{ scope.row.lu || "0" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="断后伸长率(%)" align="center" width="110">
          <template slot-scope="scope">
            <span>{{ scope.row.a || 0 }}</span>
          </template>
        </el-table-column>

        <el-table-column label="总伸长率/总伸长率(%)" align="center" width="150">
          <template slot-scope="scope">
            <span>{{ scope.row.at || 0 }}</span>
          </template>
        </el-table-column>

        <el-table-column label="最大力总伸长率" align="center" width="115">
          <template slot-scope="scope">
            <span>{{ scope.row.agt || "-" }}</span>
          </template>
        </el-table-column>

        <el-table-column label="断裂位置" align="center" width="75">
          <template slot-scope="scope">
            <span>{{ scope.row.dlwz || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="断裂性质" align="center" width="75">
          <template slot-scope="scope">
            <span>{{ scope.row.dlxz || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="试验开始时间" align="center" width="135">
          <template slot-scope="scope">
            <span>{{ scope.row.testBegin || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="试验结束时间" align="center" width="135">
          <template slot-scope="scope">
            <span>{{ scope.row.testEnd || "-" }}</span>
          </template>
        </el-table-column>
        <el-table-column label="操作" align="center" class-name="small-padding fixed-width" width="70">
          <template slot-scope="scope">
            <el-button size="mini" type="text" @click="handleForceCurve(scope.row)" v-hasPermi="['laboratoryManage:omnipotentMaterial:forceCurve']">力值曲线</el-button>
          </template>
        </el-table-column>
      </el-table>

      <pagination v-show="totalTwo > 0" :total="totalTwo" :page.sync="queryParamsTwo.pageNum"
        :limit.sync="queryParamsTwo.pageSize" @pagination="getDetailsList" />
      <span slot="footer" class="dialog-footer">
        <el-button @click="rowDetailsDialog = false" size="mini">取 消</el-button>
      </span>
    </el-dialog>
    <!-- 力值曲线 -->
    <el-dialog title="力值曲线" :visible.sync="forceCurve" width="70%">
      <div class="chartBox">
        <div id="dayChart" style="`width: 100%;height: 500px;transform-origin: 0 0;`"></div>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="forceCurve = false" size="mini">取 消</el-button>
      </span>
    </el-dialog>

    <!-- 报表预览 -->
    <yi-dialog title="报表预览" ref="dialogReportForms" :visible.sync="dialogVisible_report" width="70%" fullscreen isHandle
      :isConfirm="false" top="0vh">
      <ReportRender ref="ReportRender"></ReportRender>
      <div slot="more" class="more">
        <el-button class="print" type="primary" icon="el-icon-printer" size="small" @click="print()" v-hasPermi="['laboratoryManage:omnipotentMaterial:export']">打印/导出</el-button>
      </div>
    </yi-dialog>
    <!-- 钢筋焊接报表预览 -->
    <yi-dialog title="报表预览" ref="dialogReportForms" :visible.sync="hjdialogVisible_report" width="70%" fullscreen isHandle
      :isConfirm="false" top="0vh">
      <ReportRender ref="ReportRender"></ReportRender>
      <div slot="more" class="more">
        <el-button class="print" type="primary" icon="el-icon-printer" size="small" @click="print()" v-hasPermi="['laboratoryManage:omnipotentMaterial:export']">打印/导出</el-button>
      </div>
    </yi-dialog>
    <!-- 钢筋机械连接报表预览 -->
    <yi-dialog title="报表预览" ref="dialogReportForms" :visible.sync="jxljdialogVisible_report" width="70%" fullscreen isHandle
      :isConfirm="false" top="0vh">
      <ReportRender ref="ReportRender"></ReportRender>
      <div slot="more" class="more">
        <el-button class="print" type="primary" icon="el-icon-printer" size="small" @click="print()" v-hasPermi="['laboratoryManage:omnipotentMaterial:export']">打印/导出</el-button>
      </div>
    </yi-dialog>
    
    <!-- 报表编辑 -->
    <yi-dialog title="报表编辑" class="render-dialog" :visible.sync="dialogVisible_reportEdit" width="70%" fullscreen isHandle
      :isConfirm="false" top="0vh">
      <ReportRender v-if="dialogVisible_reportEdit" ref="ReportRender"></ReportRender>
      <div slot="more" class="more">
        <el-button type="primary" size="small" icon="el-icon-picture" @click="save()">保存</el-button>
      </div>
    </yi-dialog>
    <!-- 钢筋焊接报表编辑 -->
    <yi-dialog title="报表编辑" class="render-dialog" :visible.sync="hjdialogVisible_reportEdit" width="70%" fullscreen isHandle
      :isConfirm="false" top="0vh">
      <ReportRender v-if="hjdialogVisible_reportEdit" ref="ReportRender"></ReportRender>
      <div slot="more" class="more">
        <el-button type="primary" size="small" icon="el-icon-picture" @click="hjsave()">保存</el-button>
      </div>
    </yi-dialog>
    <!-- 钢筋机械连接报表编辑 -->
    <yi-dialog title="报表编辑" class="render-dialog" :visible.sync="jxljdialogVisible_reportEdit" width="70%" fullscreen isHandle
      :isConfirm="false" top="0vh">
      <ReportRender v-if="jxljdialogVisible_reportEdit" ref="ReportRender"></ReportRender>
      <div slot="more" class="more">
        <el-button type="primary" size="small" icon="el-icon-picture" @click="jxljsave()">保存</el-button>
      </div>
    </yi-dialog>
  </div>
</template>

<script>
import * as echarts from "echarts";
require("echarts/theme/macarons"); // echarts theme
import { deptList } from "@/api/common/common";
import { omnipotentMaterialList, omnipotentMaterialDetails,saveReport ,hjsaveReport,jxljsaveReport} from "@/api/laboratoryManage/omnipotentMaterial";
import workSiteLeft from "@/views/components/workSiteLeft";
import ReportRender from "@/views/ReportDesign/components/ReportRender/ReportRender"
import deatetime from "@/components/Datetime";
import { verifyEligible } from "@/api/xtcsgl/omnipotentRequires";
import { testCollectData} from "@/api/zhgd/hntManage";

export default {
  name: "omnipotentMaterial", //万能材料试验机
  data() {
    return {
      editId:0,
      warningLoading:false,
      dialogVisible_report: false,
      hjdialogVisible_report:false,
      jxljdialogVisible_report:false,
      dialogVisible_reportEdit: false,
      hjdialogVisible_reportEdit:false,
      jxljdialogVisible_reportEdit:false,
      detailId1:"",
      detailId2:"",
      detailId3:"",
      eligibleList: [
        { id: "0", name: "不合格" },
        { id: "1", name: "合格" },
      ],
      show: true,
      rowObj: {
        T1: 3,
        T2: 24,
        T3: 21,
        T4: 24,
        F1: 0,
        F2: 0,
        F3: 24,
        F4: 24,
      },
      ysgcsj: null,
      dayChart: null,
      forceCurve: false,
      rowId: "",
      detailsList: [], //详情列表
      queryParamsTwo: {
        pageNum: 1,
        pageSize: 10,
      },
      totalTwo: 0,
      loadingTwo: false,
      constructionList: [], //工地列表
      rowDetailsDialog: false,
      // 按钮loading
      buttonLoading: false,
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 水稳拌合站数据表格数据
      cementDataList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
      },
    };
  },
  components: {
    deatetime,
    workSiteLeft,
    ReportRender
  },
  created() {
    this.getList();
  },
  methods: {
// 点击报表编辑按钮
    result_handleUpdate(row) {
      if(row.symc == '热轧带肋钢筋' || row.symc == '钢筋原材'){
        this.dialogVisible_reportEdit = true
        this.editId = row.id;
        this.$nextTick(() => {
          this.$refs.ReportRender.editInit("ribbed_ba", {
            id: row.id,
            reportId: "1735553962221883394",
            symc: row.symc,
          });
        });
      } else if (row.symc == '钢筋焊接'){
        this.hjdialogVisible_reportEdit = true
        this.editId = row.id;
        this.$nextTick(() => {
          this.$refs.ReportRender.editInit("gjhj_bao", {
            id: row.id,
            reportId: "1731877134659543042",
            symc: row.symc,
          });
        });
        
      } else if (row.symc == '钢筋机械连接'){
        this.jxljdialogVisible_reportEdit = true
        this.editId = row.id;
        this.$nextTick(() => {
          this.$refs.ReportRender.editInit("gjjxlj_bao", {
            id: row.id,
            reportId: "1735494280149061633",
            symc: row.symc,
          });
        });
        
      }
    },
    rederOver() {
      setTimeout(() => {
        const element = this.$refs.dialogReportForms;
        element.$el.classList.add("render-report");
      }, 0);
    },
    // 点击报表预览按钮
    handleReportForms(row) {
      if(row.symc == '热轧带肋钢筋' || row.symc == '钢筋原材'){
        this.dialogVisible_report = true;
        this.$nextTick(() => {
          this.$refs.ReportRender.editDataRender("ribbed_ba", {
            id: row.id,
            reportId: "1735553962221883394",
            symc: row.symc,
          });
        });
      }else if((row.symc == '钢筋焊接')){
        this.hjdialogVisible_report = true;
        this.$nextTick(() => {
          this.$refs.ReportRender.editDataRender("gjhj_bao", {
            id: row.id,
            reportId: "1731877134659543042",
            symc: row.symc,
          });
        });

      } else if((row.symc == '钢筋机械连接')){
        this.jxljdialogVisible_report = true;
        this.$nextTick(() => {
          this.$refs.ReportRender.editDataRender("gjjxlj_bao", {
            id: row.id,
            reportId: "1735494280149061633",
            symc: row.symc,
          });
        });

      }

    },
    // 打印
    print() {
      this.$refs.ReportRender.print();
    },
    // 报表编辑保存
    save() {
      // 这个代码就是 取 报表设置的参数
      var dataBb = this.$refs.ReportRender.editSave()
      let parm = {
        list : dataBb.dataReturn[0],
        group: dataBb.dataReturn[1]
      }
      parm.id = this.editId;
      saveReport(parm).then((response) => {
        this.$modal.msgSuccess("保存成功");
      }).finally(() => {
        this.dialogVisible_reportEdit = false
        this.hjdialogVisible_reportEdit = false
        this.jxljdialogVisible_reportEdit = false
      });
    },
    //钢筋焊接 报表编辑保存
    hjsave() {
      // 这个代码就是 取 报表设置的参数
      var dataBb = this.$refs.ReportRender.editSave()
      let data = JSON.parse(dataBb.content).Api.options[0].data[0];
      let parm = {
        group: dataBb.dataReturn[1],
        id : this.editId,
        detailId1 : data.detailId1,
        detailId2 : data.detailId2,
        detailId3 : data.detailId3,
      }
      // parm.id = this.editId;
      hjsaveReport(parm).then((response) => {
        this.$modal.msgSuccess("保存成功");
      }).finally(() => {
        this.hjdialogVisible_reportEdit = false
      });
    },
    //钢筋机械连接 报表编辑保存
    jxljsave() {
      // 这个代码就是 取 报表设置的参数
      var dataBb = this.$refs.ReportRender.editSave()
      let parm = {
        list : dataBb.dataReturn[0],
        group: dataBb.dataReturn[1]
      }
      parm.id = this.editId;
      jxljsaveReport(parm).then((response) => {
        this.$modal.msgSuccess("保存成功");
      }).finally(() => {
        this.jxljdialogVisible_reportEdit = false
      });
    },

//采集数据测试
    handleCollectData(){
      this.$confirm('正式系统禁止采集数据！', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        customClass:'confirm-model',
        type: 'warning',
      }).then(_ => {
        this.warningLoading = true;
        console.log("采集数据测试")
        testCollectData('wnj',this.queryParams.id).then(res=>{
          this.getList()
          this.warningLoading = false;
          console.log("成功")
        })
      })
    },
    /** 查询工地列表 */
    getProjectList() {
      deptList().then((res) => {
        this.constructionList = res || [];
      });
    },
    /** 查询水稳拌合站数据列表 */
    getList() {
      this.loading = true;
      omnipotentMaterialList(this.queryParams).then((response) => {
        console.log("合格不合格",response)
        this.cementDataList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams = this.getSearchParams();
      this.queryParams.pageNum = 1;
      this.getList();
    },
    getSearchParams() {
      const params = {};
      for (const key in this.queryParams) {
        if (key === "time") {
          const time = this.queryParams[key];
          if (time && time.length === 2) {
            params.startTime = time[0];
            params.endTime = time[1];
          }
        } else {
          params[key] = this.queryParams[key];
        }
      }
      return params;
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.$refs.workSiteLeft.resetQuery();
      this.queryParams.id = "";
      this.$refs.deatetime.startTime = null;
      this.$refs.deatetime.endTime = null;
      this.queryParams.time = [];
      this.queryParams.startTime = "";
      this.queryParams.endTime = "";
      this.resetForm("queryForm");
      this.handleQuery();
    },

    handleDetails(row) {
      this.queryParamsTwo.pageNum = 1;
      this.queryParamsTwo.pageSize = 10;
      this.rowId = row.id;
      omnipotentMaterialDetails({
        ...this.queryParamsTwo,
        id: row.id,
      }).then((res) => {
        console.log(res);
        this.detailsList = res.rows;
        this.totalTwo = res.total;
        this.rowDetailsDialog = true;
      });
    },
    getDetailsList() {
      this.loadingTwo = true;
      omnipotentMaterialDetails({
        ...this.queryParamsTwo,
        id: this.rowId,
      }).then((response) => {
        this.detailsList = response.rows;
        this.totalTwo = response.total;
        this.loadingTwo = false;
      });
    },
    handleClose() {
      this.$confirm("确认关闭？")
        .then((_) => {
          F;
          done();
        })
        .catch((_) => { });
    },
    handleForceCurve(row) {
      this.forceCurve = true;
      this.ysgcsj = row.ysgcsj;
      let title = "万能机力值曲线";
      if (document.getElementById("dayChart")) {
        this.createDayChart(title, row.ysgcsj);
      } else {
        this.$nextTick(() => {
          this.createDayChart(title, row.ysgcsj);
        });
      }
    },
    createDayChart(title, data) {
      if (null == this.dayChart) {
        // echarts.init
        // this.dayChart = this.$echarts.init(document.getElementById('dayChart'));
        this.dayChart = echarts.init(document.getElementById("dayChart"));
      } else {
        this.dayChart.clear();
      }
      let xData = [];
      let sData = [];
      let wData = [];
      let bData = [];
      if (!!data) {
        let array = data.split(";");
        array.forEach((item) => {
          let dataItem = item.split(",");
          xData.push(dataItem[0]);
          sData.push(dataItem[1]);
          wData.push(dataItem[2]);
          bData.push(dataItem[3]);
        });
      }
      let option = this.getLineOption(
        title,
        "时间(秒)",
        xData,
        sData,
        wData,
        bData
      );
      this.dayChart.setOption(option);
    },
    /**
     * 获取图表配置信息
     */
    getLineOption(title, xName, xData, sData, wData, bData) {
      const colors = ["#5470C6", "#91CC75", "#EE6666"];
      let option = {
        color: colors,
        tooltip: {
          trigger: "axis",
          axisPointer: {
            type: "cross",
          },
          // formatter: function(params) {
          // 		var result = '';
          // 		result += params[0].name + '<br />';
          // 		for (var i = 0; i < params.length; i++) {
          // 			result += params[i].seriesName + ': ' + params[i].value + '<br />';
          // 		}
          // 		return result;
          // 	}
        },
        title: {
          text: title,
          textStyle: {
            padingLeft: 100,
          },
        },
        legend: {
          data: ["力值", "位移", "变形"],
        },
        toolbox: {
          feature: {
            dataView: { show: true, readOnly: false },
            restore: { show: true },
            saveAsImage: { show: true },
          },
        },
        xAxis: {
          name: xName,
          nameLocation: "end",
          nameTextStyle: {
            padding: [30, 0, 0, 0],
          },
          data: xData,
          axisLine: { onZero: true },
          splitLine: { show: false },
          splitArea: { show: false },
          axisTick: {
            alignWithLabel: true,
          },
          axisLabel: {
            rotate: 45,
            formatter: (value, index) => {
              return value + "秒";
            },
          },
        },

        yAxis: [
          {
            type: "value",
            name: "位移/变形(mm)",
            position: "right",
            alignTicks: true,
            axisLine: {
              show: true,
              lineStyle: {
                color: colors[0],
              },
            },
            splitLine: {
              // 网格线
              show: false,
            },
            axisLabel: {
              formatter: "{value} mm",
            },
          },
          {
            type: "value",
            name: "力值(kN)",
            position: "left",
            alignTicks: true,
            axisLine: {
              show: true,
              lineStyle: {
                color: colors[2],
              },
            },
            axisLabel: {
              formatter: "{value} kN",
            },
          },
        ],
        grid: {
          top: 60,
          bottom: 60,
          left: 60,
          right: 60,
        },
        series: [
          {
            name: "位移",
            type: "line",
            tooltip: {
              valueFormatter: function (value) {
                return value + " mm";
              },
            },
            data: wData,
          },
          {
            name: "变形",
            type: "line",
            data: bData,
            tooltip: {
              valueFormatter: function (value) {
                return value + " mm";
              },
            },
          },
          {
            name: "力值",
            type: "line",
            yAxisIndex: 1,
            data: sData,
            tooltip: {
              valueFormatter: function (value) {
                return value + " kN";
              },
            },
          },
        ],
      };
      return option;
    },
    showLeft(show) {
      this.show = !show;
    },
    queryVal(val) {
      this.queryParams.id = val.id;
      this.handleQuery();
    },
    check(row) {
      this.$confirm('正式系统禁止手动预警！', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        customClass:'confirm-model',
        type: 'warning',
      }).then(_ => {
        console.log(row);
        verifyEligible({ id: row.id }).then((res) => {
          if (res.code == 200) {
            this.getList()
            this.$message.success(res.msg);
          } else {
            this.$message.error(res.msg);
          }
          console.log(res);
        });
      })
    },
  },
};
</script>
<style scoped lang="scss">
.app-omnipotentMaterial {
  // padding-top: 16px;
  // user-select: none;

  .chartBox {
    height: 350px;
    width: 100%;
    position: relative;
  }

  .chartBoxHeight {
    height: 400px;
    width: 100%;
    position: relative;
  }

  .chartSearch {
    position: absolute;
    top: 0px;
    right: 60px;
  }
}
</style>
<style>
.confirm-model{
.el-message-box__btns {
.el-button:nth-child(1) {
  float:right;
}
.el-button:nth-child(2) {
  margin-right:10px;
  /*background-color:#2d8cf0;*/
  /*border-color:#2d8cf0;*/
}
}
}
</style>
